package proxy.gui;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class ConnectionRenderer extends DefaultTableCellRenderer {

	private static final long serialVersionUID = -1453282846743302950L;
	public static Color odd = new Color(238, 238, 238);
	public static Color even = Color.WHITE;
	public static Color selected = new Color(51, 153, 255);
	
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		if (column == 0) value = String.valueOf(row + 1);
		Component view = super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
				row, column);
		if (row % 2 == 0){
			view.setBackground(even);
		}else{
			view.setBackground(odd);
		}
		if (isSelected) view.setBackground(selected);
		return view;
	}

}
